<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Standard Filter Classes - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.filter.set.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.filter.set.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.filter.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.filter.html">Zend_Filter</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.filter.filter_chains.html">Filter Chains</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.filter.set" class="section"><div class="info"><h1 class="title">Standard Filter Classes</h1></div>
    

    <p class="para">
        Zend Framework comes with a standard set of filters, which are ready for you to use.
    </p>

    <div class="section" id="zend.filter.set.alnum"><div class="info"><h1 class="title">Alnum</h1></div>
    

    <p class="para">
        <span class="classname">Zend_Filter_Alnum</span> is a filter which returns only alphabetic
        characters and digits. All other characters are supressed.
    </p>

    <div class="section" id="zend.filter.set.alnum.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Alnum</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_Alnum</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">allowwhitespace</span></em>: If this option is set
                    then whitespace characters are allowed. Otherwise they are supressed. Per
                    default whitespaces are not allowed.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.alnum.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            See the following example for the default behaviour of this filter.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Alnum();
$return = $filter-&gt;filter(&#039;This is (my) content: 123&#039;);
// returns &#039;Thisismycontent123&#039;
</pre>


        <p class="para">
            The above example returns &#039;Thisismycontent123&#039;. As you see all whitespaces and also the
            brackets are filtered.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                <span class="classname">Zend_Filter_Alnum</span> works on almost all languages. But actually
                there are three exceptions: Chinese, Japanese and Korean. Within these languages the
                english alphabet is use instead of the characters from these languages. The language
                itself is detected by using <span class="classname">Zend_Locale</span>.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.filter.set.alnum.whitespace"><div class="info"><h1 class="title">Allow whitespaces</h1></div>
        

        <p class="para">
            <span class="classname">Zend_Filter_Alnum</span> can also allow whitespaces. This can be usefull
            when you want to strip special chars from a text. See the following example:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Alnum(array(&#039;allowwhitespace&#039; =&gt; true));
$return = $filter-&gt;filter(&#039;This is (my) content: 123&#039;);
// returns &#039;This is my content 123&#039;
</pre>


        <p class="para">
            The above example returns &#039;This is my content 123&#039;. As you see only the brackets are
            filtered whereas the whitespaces are not touched.
        </p>

        <p class="para">
            To change <span class="property">allowWhiteSpace</span> afterwards you can use
             <span class="methodname">setAllowWhiteSpace()</span> and
             <span class="methodname">getAllowWhiteSpace()</span>.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.alpha"><div class="info"><h1 class="title">Alpha</h1></div>
    

    <p class="para">
        <span class="classname">Zend_Filter_Alpha</span> is a filter which returns the string
        <var class="varname">$value</var>, removing all but alphabetic characters. This filter includes an
        option to also allow white space characters.
    </p>

    <div class="section" id="zend.filter.set.alpha.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Alpha</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_Alpha</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">allowwhitespace</span></em>: If this option is
                    set then whitespace characters are allowed. Otherwise they are suppressed. By
                    default whitespace characters are not allowed.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.alpha.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            A basic example of usage is below:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Alpha();

print $filter-&gt;filter(&#039;This is (my) content: 123&#039;);
</pre>


        <p class="para">
            The above example returns &#039;Thisismycontent&#039;. Notice that the whitespace characters and
            brackets are removed.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                <span class="classname">Zend_Filter_Alpha</span> works on most languages; however, there
                are three exceptions: Chinese, Japanese and Korean. With these languages the
                english alphabet is used. The language is detected through the use of
                <span class="classname">Zend_Locale</span>.
            </p>
        </p></blockquote>
    </div>

     <div class="section" id="zend.filter.set.alpha.whitespace"><div class="info"><h1 class="title">Allow whitespace characters</h1></div>
         

        <p class="para">
            <span class="classname">Zend_Filter_Alpha</span> can also allow whitespace characters. This can
            be useful when you want to strip special characters from a string. See the following
            example:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Alpha(array(&#039;allowwhitespace&#039; =&gt; true));

print $filter-&gt;filter(&#039;This is (my) content: 123&#039;);
</pre>


        <p class="para">
            The above example returns &#039;This is my content &#039;. Notice that the parenthesis, colon, and
            numbers have all been removed while the whitespace characters remain.
        </p>

        <p class="para">
            To change <span class="property">allowWhiteSpace</span> after instantiation the method
             <span class="methodname">setAllowWhiteSpace()</span> may be used.
        </p>

        <p class="para">
            To query the current value of <span class="property">allowWhiteSpace</span> the method
             <span class="methodname">getAllowWhiteSpace()</span> may be used.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.basename"><div class="info"><h1 class="title">BaseName</h1></div>
    

    <p class="para">
        <span class="classname">Zend_Filter_BaseName</span> allows you to filter a string which contains
        the path to a file and it will return the base name of this file.
    </p>

    <div class="section" id="zend.filter.set.basename.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_BaseName</h1></div>
        

        <p class="para">
            There are no additional options for <span class="classname">Zend_Filter_BaseName</span>.
        </p>
    </div>

    <div class="section" id="zend.filter.set.basename.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            A basic example of usage is below:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_BaseName();

print $filter-&gt;filter(&#039;/vol/tmp/filename&#039;);
</pre>


        <p class="para">
            This will return &#039;filename&#039;.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_BaseName();

print $filter-&gt;filter(&#039;/vol/tmp/filename.txt&#039;);
</pre>


        <p class="para">
            This will return &#039;<var class="filename">filename.txt</var>&#039;.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.boolean"><div class="info"><h1 class="title">Boolean</h1></div>
    

    <p class="para">
        This filter changes a given input to be a <b><tt>BOOLEAN</tt></b> value. This is often
        useful when working with databases or when processing form values.
    </p>

    <div class="section" id="zend.filter.set.boolean.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Boolean</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_Boolean</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">casting</span></em>: When this option is set to
                    <b><tt>TRUE</tt></b> then any given input will be casted to boolean. This
                    option defaults to <b><tt>TRUE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">locale</span></em>: This option sets the locale
                    which will be used to detect localized input.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">type</span></em>: The <span class="property">type</span>
                    option sets the boolean type which should be used. Read the following for
                    details.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.boolean.default"><div class="info"><h1 class="title">Default behaviour for Zend_Filter_Boolean</h1></div>
        

        <p class="para">
            By default, this filter works by casting the input to a <b><tt>BOOLEAN</tt></b>
            value; in other words, it operates in a similar fashion to calling
            <strong class="command">(boolean) $value</strong>.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Boolean();
$value  = &#039;&#039;;
$result = $filter-&gt;filter($value);
// returns false
</pre>


        <p class="para">
            This means that without providing any configuration,
            <span class="classname">Zend_Filter_Boolean</span> accepts all input types and returns a
            <b><tt>BOOLEAN</tt></b> just as you would get by type casting to
            <b><tt>BOOLEAN</tt></b>.
        </p>
    </div>

    <div class="section" id="zend.filter.set.boolean.types"><div class="info"><h1 class="title">Changing behaviour for Zend_Filter_Boolean</h1></div>
        

        <p class="para">
            Sometimes casting with <strong class="command">(boolean)</strong> will not suffice.
            <span class="classname">Zend_Filter_Boolean</span> allows you to configure specific types to
            convert, as well as which to omit.
        </p>

        <p class="para">
            The following types can be handled:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">boolean</em>: Returns a boolean value as is.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">integer</em>: Converts an integer <em class="emphasis">0</em> value
                    to <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">float</em>: Converts a float <em class="emphasis">0.0</em> value
                    to <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">string</em>: Converts an empty string <em class="emphasis">&#039;&#039;</em> to
                    <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">zero</em>: Converts a string containing the single character
                    zero (<em class="emphasis">&#039;0&#039;</em>) to <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">empty_array</em>: Converts an empty <em class="emphasis">array</em>
                    to <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">null</em>: Converts a <b><tt>NULL</tt></b> value
                    to <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">php</em>: Converts values according to <acronym class="acronym">PHP</acronym>
                    when casting them to <b><tt>BOOLEAN</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">false_string</em>: Converts a string containing the word &quot;false&quot;
                    to a boolean <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">yes</em>: Converts a localized string which contains the word
                    &quot;no&quot; to <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">all</em>: Converts all above types to
                    <b><tt>BOOLEAN</tt></b>.
                </p>
            </li>
        </ul>

        <p class="para">
            All other given values will return <b><tt>TRUE</tt></b> by default.
        </p>

        <p class="para">
            There are several ways to select which of the above types are filtered. You can give one
            or multiple types and add them, you can give an array, you can use constants, or you can
            give a textual string. See the following examples:
        </p>

        <pre class="programlisting brush: php">
// converts 0 to false
$filter = new Zend_Filter_Boolean(Zend_Filter_Boolean::INTEGER);

// converts 0 and &#039;0&#039; to false
$filter = new Zend_Filter_Boolean(
    Zend_Filter_Boolean::INTEGER + Zend_Filter_Boolean::ZERO
);

// converts 0 and &#039;0&#039; to false
$filter = new Zend_Filter_Boolean(array(
    &#039;type&#039; =&gt; array(
        Zend_Filter_Boolean::INTEGER,
        Zend_Filter_Boolean::ZERO,
    ),
));

// converts 0 and &#039;0&#039; to false
$filter = new Zend_Filter_Boolean(array(
    &#039;type&#039; =&gt; array(
        &#039;integer&#039;,
        &#039;zero&#039;,
    ),
));
</pre>


        <p class="para">
            You can also give an instance of <span class="classname">Zend_Config</span> to set the desired
            types. To set types after instantiation, use the  <span class="methodname">setType()</span>
            method.
        </p>
    </div>

    <div class="section" id="zend.filter.set.boolean.localized"><div class="info"><h1 class="title">Localized booleans</h1></div>
        

        <p class="para">
            As mentioned previously, <span class="classname">Zend_Filter_Boolean</span> can also recognise
            localized &quot;yes&quot; and &quot;no&quot; strings. This means that you can ask your customer in a form
            for &quot;yes&quot; or &quot;no&quot; within his native language and
            <span class="classname">Zend_Filter_Boolean</span> will convert the response to the appropriate
            boolean value.
        </p>

        <p class="para">
            To set the desired locale, you can either use the <span class="property">locale</span> option, or
            the method  <span class="methodname">setLocale()</span>.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Boolean(array(
    &#039;type&#039;   =&gt; Zend_Filter_Boolean::ALL,
    &#039;locale&#039; =&gt; &#039;de&#039;,
));

// returns false
echo $filter-&gt;filter(&#039;nein&#039;);

$filter-&gt;setLocale(&#039;en&#039;);

// returns true
$filter-&gt;filter(&#039;yes&#039;);
</pre>

    </div>

    <div class="section" id="zend.filter.set.boolean.casting"><div class="info"><h1 class="title">Disable casting</h1></div>
        

        <p class="para">
            Sometimes it is necessary to recognise only <b><tt>TRUE</tt></b> or
            <b><tt>FALSE</tt></b> and return all other values without changes.
            <span class="classname">Zend_Filter_Boolean</span> allows you to do this by setting the
            <span class="property">casting</span> option to <b><tt>FALSE</tt></b>.
        </p>

        <p class="para">
            In this case <span class="classname">Zend_Filter_Boolean</span> will work as described in the
            following table, which shows which values return <b><tt>TRUE</tt></b> or
            <b><tt>FALSE</tt></b>. All other given values are returned without change when
            <span class="property">casting</span> is set to <b><tt>FALSE</tt></b>
        </p>

        <table id="zend.filter.set.boolean.casting.table" class="doctable table"><div class="info"><caption><b>Usage without casting</b></caption></div>
            
            
                <thead valign="middle">
                    <tr valign="middle">
                        <th>Type</th>
                        <th>True</th>
                        <th>False</th>
                    </tr>

                </thead>


                <tbody valign="middle" class="tbody">
                    <tr valign="middle">
                        <td align="left"><b><tt>Zend_Filter_Boolean::BOOLEAN</tt></b></td>
                        <td align="left"><b><tt>TRUE</tt></b></td>
                        <td align="left"><b><tt>FALSE</tt></b></td>
                    </tr>


                    <tr valign="middle">
                        <td align="left"><b><tt>Zend_Filter_Boolean::INTEGER</tt></b></td>
                        <td align="left">0</td>
                        <td align="left">1</td>
                    </tr>


                    <tr valign="middle">
                        <td align="left"><b><tt>Zend_Filter_Boolean::FLOAT</tt></b></td>
                        <td align="left">0.0</td>
                        <td align="left">1.0</td>
                    </tr>


                    <tr valign="middle">
                        <td align="left"><b><tt>Zend_Filter_Boolean::STRING</tt></b></td>
                        <td align="left">&quot;&quot;</td>
                        <td class="empty">&nbsp;</td>
                    </tr>


                    <tr valign="middle">
                        <td align="left"><b><tt>Zend_Filter_Boolean::ZERO</tt></b></td>
                        <td align="left">&quot;0&quot;</td>
                        <td align="left">&quot;1&quot;</td>
                    </tr>


                    <tr valign="middle">
                        <td align="left"><b><tt>Zend_Filter_Boolean::EMPTY_ARRAY</tt></b></td>
                        <td align="left"> <span class="methodname">array()</span></td>
                        <td class="empty">&nbsp;</td>
                    </tr>


                    <tr valign="middle">
                        <td align="left"><b><tt>Zend_Filter_Boolean::NULL</tt></b></td>
                        <td align="left"><b><tt>NULL</tt></b></td>
                        <td class="empty">&nbsp;</td>
                    </tr>


                    <tr valign="middle">
                        <td align="left"><b><tt>Zend_Filter_Boolean::FALSE_STRING</tt></b></td>
                        <td align="left">&quot;false&quot; (case independently)</td>
                        <td align="left">&quot;true&quot; (case independently)</td>
                    </tr>


                    <tr valign="middle">
                        <td align="left"><b><tt>Zend_Filter_Boolean::YES</tt></b></td>
                        <td align="left">localized &quot;yes&quot; (case independently)</td>
                        <td align="left">localized &quot;no&quot; (case independently)</td>
                    </tr>

                </tbody>
            
        </table>


        <p class="para">
            The following example shows the behaviour when changing the <span class="property">casting</span>
            option:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Boolean(array(
    &#039;type&#039;    =&gt; Zend_Filter_Boolean::ALL,
    &#039;casting&#039; =&gt; false,
));

// returns false
echo $filter-&gt;filter(0);

// returns true
echo $filter-&gt;filter(1);

// returns the value
echo $filter-&gt;filter(2);
</pre>

    </div>
</div>
    <div class="section" id="zend.filter.set.callback"><div class="info"><h1 class="title">Callback</h1></div>
    

    <p class="para">
        This filter allows you to use own methods in conjunction with
        <span class="classname">Zend_Filter</span>. You don&#039;t have to create a new filter when you already
        have a method which does the job.
    </p>

    <div class="section" id="zend.filter.set.callback.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Callback</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_Callback</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">callback</span></em>: This sets the callback
                    which should be used.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">options</span></em>: This property sets the
                    options which are used when the callback is processed.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.callback.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            The usage of this filter is quite simple. Let&#039;s expect we want to create a filter which
            reverses a string.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Callback(&#039;strrev&#039;);

print $filter-&gt;filter(&#039;Hello!&#039;);
// returns &quot;!olleH&quot;
</pre>


        <p class="para">
            As you can see it&#039;s really simple to use a callback to define a own filter. It is also
            possible to use a method, which is defined within a class, by giving an array as
            callback.
        </p>

        <pre class="programlisting brush: php">
// Our classdefinition
class MyClass
{
    public function Reverse($param);
}

// The filter definition
$filter = new Zend_Filter_Callback(array(&#039;MyClass&#039;, &#039;Reverse&#039;));
print $filter-&gt;filter(&#039;Hello!&#039;);
</pre>


        <p class="para">
            To get the actual set callback use  <span class="methodname">getCallback()</span> and to set
            another callback use  <span class="methodname">setCallback()</span>.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Possible exceptions</b><br /></span>
            

            <p class="para">
                You should note that defining a callback method which can not be called will raise
                an exception.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.filter.set.callback.parameters"><div class="info"><h1 class="title">Default parameters within a callback</h1></div>
        

        <p class="para">
            It is also possible to define default parameters, which are given to the called method
            as array when the filter is executed. This array will be concatenated with the value
            which will be filtered.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Callback(
    array(
        &#039;callback&#039; =&gt; &#039;MyMethod&#039;,
        &#039;options&#039;  =&gt; array(&#039;key&#039; =&gt; &#039;param1&#039;, &#039;key2&#039; =&gt; &#039;param2&#039;)
    )
);
$filter-&gt;filter(array(&#039;value&#039; =&gt; &#039;Hello&#039;));
</pre>


        <p class="para">
            When you would call the above method definition manually it would look like this:
        </p>

        <pre class="programlisting brush: php">
$value = MyMethod(&#039;Hello&#039;, &#039;param1&#039;, &#039;param2&#039;);
</pre>

    </div>
</div>
    <div class="section" id="zend.filter.set.compress"><div class="info"><h1 class="title">Compress and Decompress</h1></div>
    

    <p class="para">
        These two filters are capable of compressing and decompressing strings, files, and
        directories.
    </p>

    <div class="section" id="zend.filter.set.compress.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Compress and Zend_Filter_Decompress</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_Compress</span>
            and <span class="classname">Zend_Filter_Decompress</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">adapter</span></em>: The compression adapter which
                    should be used. It defaults to <span class="property">Gz</span>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">options</span></em>: Additional options which are
                    given to the adapter at initiation. Each adapter supports it&#039;s own options.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.compress.basic"><div class="info"><h1 class="title">Supported compression adapters</h1></div>
        

        <p class="para">
            The following compression formats are supported by their own adapter:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Bz2</em>
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Gz</em>
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Lzf</em>
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Rar</em>
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Tar</em>
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Zip</em>
                </p>
            </li>
        </ul>

        <p class="para">
            Each compression format has different capabilities as described below. All compression
            filters may be used in approximately the same ways, and differ primarily in the options
            available and the type of compression they offer (both algorithmically as well as string
            vs. file vs. directory)
        </p>
    </div>

    <div class="section" id="zend.filter.set.compress.generic"><div class="info"><h1 class="title">Generic handling</h1></div>
        

        <p class="para">
            To create a compression filter you need to select the compression format you want to
            use. The following description takes the <em class="emphasis">Bz2</em> adapter. Details for
            all other adapters are described after this section.
        </p>

        <p class="para">
            The two filters are basically identical, in that they utilize the same backends.
            <span class="classname">Zend_Filter_Compress</span> should be used when you wish to compress
            items, and <span class="classname">Zend_Filter_Decompress</span> should be used when you wish to
            decompress items.
        </p>

        <p class="para">
            For instance, if we want to compress a string, we have to initiate
            <span class="classname">Zend_Filter_Compress</span> and indicate the desired adapter.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Compress(&#039;Bz2&#039;);
</pre>


        <p class="para">
            To use a different adapter, you simply specify it to the constructor.
        </p>

        <p class="para">
            You may also provide an array of options or <span class="classname">Zend_Config</span> object.
            If you do, provide minimally the key &quot;adapter&quot;, and then either the key &quot;options&quot; or
            &quot;adapterOptions&quot; (which should be an array of options to provide to the adapter on
            instantiation).
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Compress(array(
    &#039;adapter&#039; =&gt; &#039;Bz2&#039;,
    &#039;options&#039; =&gt; array(
        &#039;blocksize&#039; =&gt; 8,
    ),
));
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Default compression Adapter</b><br /></span>
            

            <p class="para">
                When no compression adapter is given, then the <em class="emphasis">Gz</em> adapter will
                be used.
            </p>
        </p></blockquote>

        <p class="para">
            Almost the same usage is we want to decompress a string. We just have to use the
            decompression filter in this case.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Decompress(&#039;Bz2&#039;);
</pre>


        <p class="para">
            To get the compressed string, we have to give the original string. The filtered value is
            the compressed version of the original string.
        </p>

        <pre class="programlisting brush: php">
$filter     = new Zend_Filter_Compress(&#039;Bz2&#039;);
$compressed = $filter-&gt;filter(&#039;Uncompressed string&#039;);
// Returns the compressed string
</pre>


        <p class="para">
            Decompression works the same way.
        </p>

        <pre class="programlisting brush: php">
$filter     = new Zend_Filter_Decompress(&#039;Bz2&#039;);
$compressed = $filter-&gt;filter(&#039;Compressed string&#039;);
// Returns the uncompressed string
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Note on string compression</b><br /></span>
            

            <p class="para">
                Not all adapters support string compression. Compression formats like
                <em class="emphasis">Rar</em> can only handle files and directories. For details, consult
                the section for the adapter you wish to use.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.filter.set.compress.archive"><div class="info"><h1 class="title">Creating an archive</h1></div>
        

        <p class="para">
            Creating an archive file works almost the same as compressing a string. However, in this
            case we need an additional parameter which holds the name of the archive we want to
            create.
        </p>

        <pre class="programlisting brush: php">
$filter     = new Zend_Filter_Compress(array(
    &#039;adapter&#039; =&gt; &#039;Bz2&#039;,
    &#039;options&#039; =&gt; array(
        &#039;archive&#039; =&gt; &#039;filename.bz2&#039;,
    ),
));
$compressed = $filter-&gt;filter(&#039;Uncompressed string&#039;);
// Returns true on success and creates the archive file
</pre>


        <p class="para">
            In the above example the uncompressed string is compressed, and is then written into
            the given archive file.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Existing archives will be overwritten</b><br /></span>
            

            <p class="para">
                The content of any existing file will be overwritten when the given filename of
                the archive already exists.
            </p>
        </p></blockquote>

        <p class="para">
            When you want to compress a file, then you must give the name of the file with its path.
        </p>

        <pre class="programlisting brush: php">
$filter     = new Zend_Filter_Compress(array(
    &#039;adapter&#039; =&gt; &#039;Bz2&#039;,
    &#039;options&#039; =&gt; array(
        &#039;archive&#039; =&gt; &#039;filename.bz2&#039;
    ),
));
$compressed = $filter-&gt;filter(&#039;C:\temp\compressme.txt&#039;);
// Returns true on success and creates the archive file
</pre>


        <p class="para">
            You may also specify a directory instead of a filename. In this case the whole directory
            with all its files and subdirectories will be compressed into the archive.
        </p>

        <pre class="programlisting brush: php">
$filter     = new Zend_Filter_Compress(array(
    &#039;adapter&#039; =&gt; &#039;Bz2&#039;,
    &#039;options&#039; =&gt; array(
        &#039;archive&#039; =&gt; &#039;filename.bz2&#039;
    ),
));
$compressed = $filter-&gt;filter(&#039;C:\temp\somedir&#039;);
// Returns true on success and creates the archive file
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Do not compress large or base directories</b><br /></span>
            

            <p class="para">
                You should never compress large or base directories like a complete partition.
                Compressing a complete partition is a very time consuming task which can lead
                to massive problems on your server when there is not enough space or your
                script takes too much time.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.filter.set.compress.decompress"><div class="info"><h1 class="title">Decompressing an archive</h1></div>
        

        <p class="para">
            Decompressing an archive file works almost like compressing it. You must specify either
            the <span class="property">archive</span> parameter, or give the filename of the archive when you
            decompress the file.
        </p>

        <pre class="programlisting brush: php">
$filter     = new Zend_Filter_Decompress(&#039;Bz2&#039;);
$compressed = $filter-&gt;filter(&#039;filename.bz2&#039;);
// Returns true on success and decompresses the archive file
</pre>


        <p class="para">
            Some adapters support decompressing the archive into another subdirectory. In this
            case you can set the <span class="property">target</span> parameter.
        </p>

        <pre class="programlisting brush: php">
$filter     = new Zend_Filter_Decompress(array(
    &#039;adapter&#039; =&gt; &#039;Zip&#039;,
    &#039;options&#039; =&gt; array(
        &#039;target&#039; =&gt; &#039;C:\temp&#039;,
    )
));
$compressed = $filter-&gt;filter(&#039;filename.zip&#039;);
// Returns true on success and decompresses the archive file
// into the given target directory
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Directories to extract to must exist</b><br /></span>
            

            <p class="para">
                When you want to decompress an archive into a directory, then that directory must
                exist.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.filter.set.compress.bz2"><div class="info"><h1 class="title">Bz2 Adapter</h1></div>
        

        <p class="para">
            The Bz2 Adapter can compress and decompress:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">Strings</p>
            </li>

            <li class="listitem">
                <p class="para">Files</p>
            </li>

            <li class="listitem">
                <p class="para">Directories</p>
            </li>
        </ul>

        <p class="para">
            This adapter makes use of <acronym class="acronym">PHP</acronym>&#039;s Bz2 extension.
        </p>

        <p class="para">
            To customize compression, this adapter supports the following options:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Archive</em>: This parameter sets the archive file which should
                    be used or created.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Blocksize</em>: This parameter sets the blocksize to use. It
                    can be from &#039;0&#039; to &#039;9&#039;. The default value is &#039;4&#039;.
                </p>
            </li>
        </ul>

        <p class="para">
            All options can be set at instantiation or by using a related method. For example, the
            related methods for &#039;Blocksize&#039; are  <span class="methodname">getBlocksize()</span> and
             <span class="methodname">setBlocksize()</span>. You can also use the
             <span class="methodname">setOptions()</span> method which accepts all options as array.
        </p>
    </div>

    <div class="section" id="zend.filter.set.compress.gz"><div class="info"><h1 class="title">Gz Adapter</h1></div>
        

        <p class="para">
            The Gz Adapter can compress and decompress:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">Strings</p>
            </li>

            <li class="listitem">
                <p class="para">Files</p>
            </li>

            <li class="listitem">
                <p class="para">Directories</p>
            </li>
        </ul>

        <p class="para">
            This adapter makes use of <acronym class="acronym">PHP</acronym>&#039;s Zlib extension.
        </p>

        <p class="para">
            To customize the compression this adapter supports the following options:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Archive</em>: This parameter sets the archive file which should
                    be used or created.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Level</em>: This compression level to use. It can be from &#039;0&#039; to
                    &#039;9&#039;. The default value is &#039;9&#039;.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Mode</em>: There are two supported modes. &#039;compress&#039; and
                    &#039;deflate&#039;. The default value is &#039;compress&#039;.
                </p>
            </li>
        </ul>

        <p class="para">
            All options can be set at initiation or by using a related method. For example, the
            related methods for &#039;Level&#039; are  <span class="methodname">getLevel()</span> and
             <span class="methodname">setLevel()</span>. You can also use the
             <span class="methodname">setOptions()</span> method which accepts all options as array.
        </p>
    </div>

    <div class="section" id="zend.filter.set.compress.lzf"><div class="info"><h1 class="title">Lzf Adapter</h1></div>
        

        <p class="para">
            The Lzf Adapter can compress and decompress:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">Strings</p>
            </li>
        </ul>

        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Lzf supports only strings</b><br /></span>
            

            <p class="para">
                The Lzf adapter can not handle files and directories.
            </p>
        </p></blockquote>

        <p class="para">
            This adapter makes use of <acronym class="acronym">PHP</acronym>&#039;s Lzf extension.
        </p>

        <p class="para">
            There are no options available to customize this adapter.
        </p>
    </div>

    <div class="section" id="zend.filter.set.compress.rar"><div class="info"><h1 class="title">Rar Adapter</h1></div>
        

        <p class="para">
            The Rar Adapter can compress and decompress:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">Files</p>
            </li>

            <li class="listitem">
                <p class="para">Directories</p>
            </li>
        </ul>

        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Rar does not support strings</b><br /></span>
            

            <p class="para">
                The Rar Adapter can not handle strings.
            </p>
        </p></blockquote>

        <p class="para">
            This adapter makes use of <acronym class="acronym">PHP</acronym>&#039;s Rar extension.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Rar compression not supported</b><br /></span>
            

            <p class="para">
                Due to restrictions with the Rar compression format, there is no compression
                available for free. When you want to compress files into a new Rar archive, you must
                provide a callback to the adapter that can invoke a Rar compression program.
            </p>
        </p></blockquote>

        <p class="para">
            To customize the compression this adapter supports the following options:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Archive</em>: This parameter sets the archive file which should
                    be used or created.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Callback</em>: A callback which provides compression support to
                    this adapter.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Password</em>: The password which has to be used for
                    decompression.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Target</em>: The target where the decompressed files will be
                    written to.
                </p>
            </li>
        </ul>

        <p class="para">
            All options can be set at instantiation or by using a related method. For example, the
            related methods for &#039;Target&#039; are  <span class="methodname">getTarget()</span> and
             <span class="methodname">setTarget()</span>. You can also use the
             <span class="methodname">setOptions()</span> method which accepts all options as array.
        </p>
    </div>

    <div class="section" id="zend.filter.set.compress.tar"><div class="info"><h1 class="title">Tar Adapter</h1></div>
        

        <p class="para">
            The Tar Adapter can compress and decompress:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">Files</p>
            </li>

            <li class="listitem">
                <p class="para">Directories</p>
            </li>
        </ul>

        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Tar does not support strings</b><br /></span>
            

            <p class="para">
                The Tar Adapter can not handle strings.
            </p>
        </p></blockquote>

        <p class="para">
            This adapter makes use of <acronym class="acronym">PEAR</acronym>&#039;s <span class="classname">Archive_Tar</span>
            component.
        </p>

        <p class="para">
            To customize the compression this adapter supports the following options:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Archive</em>: This parameter sets the archive file which should
                    be used or created.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Mode</em>: A mode to use for compression. Supported are either
                    &#039;<b><tt>NULL</tt></b>&#039; which means no compression at all, &#039;Gz&#039; which makes
                    use of <acronym class="acronym">PHP</acronym>&#039;s Zlib extension and &#039;Bz2&#039; which makes use of
                    <acronym class="acronym">PHP</acronym>&#039;s Bz2 extension. The default value is
                    &#039;<b><tt>NULL</tt></b>&#039;.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Target</em>: The target where the decompressed files will be
                    written to.
                </p>
            </li>
        </ul>

        <p class="para">
            All options can be set at instantiation or by using a related method. For example, the
            related methods for &#039;Target&#039; are  <span class="methodname">getTarget()</span> and
             <span class="methodname">setTarget()</span>. You can also use the
             <span class="methodname">setOptions()</span> method which accepts all options as array.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Directory usage</b><br /></span>
            

            <p class="para">
                When compressing directories with Tar then the complete file path is used. This
                means that created Tar files will not only have the subdirectory but the complete
                path for the compressed file.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.filter.set.compress.zip"><div class="info"><h1 class="title">Zip Adapter</h1></div>
        

        <p class="para">
            The Zip Adapter can compress and decompress:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">Strings</p>
            </li>

            <li class="listitem">
                <p class="para">Files</p>
            </li>

            <li class="listitem">
                <p class="para">Directories</p>
            </li>
        </ul>

        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Zip does not support string decompression</b><br /></span>
            

            <p class="para">
                The Zip Adapter can not handle decompression to a string; decompression will
                always be written to a file.
            </p>
        </p></blockquote>

        <p class="para">
            This adapter makes use of <acronym class="acronym">PHP</acronym>&#039;s <span class="classname">Zip</span>
            extension.
        </p>

        <p class="para">
            To customize the compression this adapter supports the following options:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Archive</em>: This parameter sets the archive file which should
                    be used or created.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">Target</em>: The target where the decompressed files will be
                    written to.
                </p>
            </li>
        </ul>

        <p class="para">
            All options can be set at instantiation or by using a related method. For example, the
            related methods for &#039;Target&#039; are  <span class="methodname">getTarget()</span> and
             <span class="methodname">setTarget()</span>. You can also use the
             <span class="methodname">setOptions()</span> method which accepts all options as array.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.digits"><div class="info"><h1 class="title">Digits</h1></div>
    

    <p class="para">
        Returns the string <var class="varname">$value</var>, removing all but digits.
    </p>

     <div class="section" id="zend.filter.set.digits.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Digits</h1></div>
        

        <p class="para">
            There are no additional options for <span class="classname">Zend_Filter_Digits</span>.
        </p>
    </div>

     <div class="section" id="zend.filter.set.digits.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            A basic example of usage is below:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Digits();

print $filter-&gt;filter(&#039;October 2009&#039;);
</pre>


        <p class="para">
            This returns &quot;2009&quot;.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Digits();

print $filter-&gt;filter(&#039;HTML 5 for Dummies&#039;);
</pre>


        <p class="para">
            This returns &quot;5&quot;.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.dir"><div class="info"><h1 class="title">Dir</h1></div>
    

    <p class="para">
        Given a string containing a path to a file, this function will return the
        name of the directory.
    </p>

     <div class="section" id="zend.filter.set.dir.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Dir</h1></div>
        

        <p class="para">
            There are no additional options for <span class="classname">Zend_Filter_Dir</span>.
        </p>
    </div>

     <div class="section" id="zend.filter.set.dir.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            A basic example of usage is below:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Dir();

print $filter-&gt;filter(&#039;/etc/passwd&#039;);
</pre>


        <p class="para">
            This returns &quot;<var class="filename">/etc</var>&quot;.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Dir();

print $filter-&gt;filter(&#039;C:/Temp/x&#039;);
</pre>


        <p class="para">
            This returns &quot;<var class="filename">C:/Temp</var>&quot;.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.encrypt"><div class="info"><h1 class="title">Encrypt and Decrypt</h1></div>
    

    <p class="para">
        These filters allow to encrypt and decrypt any given string. Therefor they make use of
        Adapters. Actually there are adapters for the <span class="classname">Mcrypt</span> and
        <span class="classname">OpenSSL</span> extensions from <acronym class="acronym">PHP</acronym>.
    </p>

    <div class="section" id="zend.filter.set.encrypt.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Encrypt and Zend_Filter_Decrypt</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_Encrypt</span> and
            <span class="classname">Zend_Filter_Decrypt</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">adapter</span></em>: This sets the encryption
                    adapter which should be used
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">algorithm</span></em>: Only
                    <span class="classname">MCrypt</span>. The algorithm which has to be used. It should be
                    one of the algorithm ciphers which can be found under
                    <a href="http://php.net/mcrypt" class="link external">&raquo; PHP&#039;s mcrypt ciphers</a>. If not set it
                    defaults to <span class="property">blowfish</span>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">algorithm_directory</span></em>: Only
                    <span class="classname">MCrypt</span>. The directory where the algorithm can
                    be found. If not set it defaults to the path set within the mcrypt extension.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">compression</span></em>: If the encrypted value
                    should be compressed. Default is no compression.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">envelope</span></em>: Only
                    <span class="classname">OpenSSL</span>. The encrypted envelope key from the user who
                    encrypted the content. You can either provide the path and filename of the key
                    file, or just the content of the key file itself. When the
                    <span class="property">package</span> option has been set, then you can omit this
                    parameter.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">key</span></em>: Only
                    <span class="classname">MCrypt</span>. The encryption key with which the input will be
                    encrypted. You need the same key for decryption.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">mode</span></em>: Only
                    <span class="classname">MCrypt</span>. The encryption mode which has to be used. It
                    should be one of the modes which can be found under
                    <a href="http://php.net/mcrypt" class="link external">&raquo; PHP&#039;s mcrypt modes</a>. If not set it
                    defaults to &#039;cbc&#039;.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">mode_directory</span></em>: Only
                    <span class="classname">MCrypt</span>. The directory where the mode can be found.
                    If not set it defaults to the path set within the <span class="classname">Mcrypt</span>
                    extension.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">package</span></em>: Only
                    <span class="classname">OpenSSL</span>. If the envelope key should be packed with the
                    encrypted value. Default is <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">private</span></em>: Only
                    <span class="classname">OpenSSL</span>. Your private key which will be used for
                    encrypting the content. Also the private key can be either a filename with path
                    of the key file, or just the content of the key file itself.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">public</span></em>: Only
                    <span class="classname">OpenSSL</span>. The public key of the user whom you want to
                    provide the encrpted content. You can give multiple public keys by using an
                    array. You can eigther provide the path and filename of the key file, or just
                    the content of the key file itself.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">salt</span></em>: Only
                    <span class="classname">MCrypt</span>. If the key should be used as salt value. The key
                    used for encryption will then itself also be encrypted. Default is
                    <b><tt>FALSE</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">vector</span></em>: Only
                    <span class="classname">MCrypt</span>. The initialization vector which shall be used. If
                    not set it will be a random vector.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.encrypt.adapterusage"><div class="info"><h1 class="title">Adapter usage</h1></div>
        

        <p class="para">
            As these two encryption methodologies work completely different, also the usage of the
            adapters differ. You have to select the adapter you want to use when initiating the
            filter.
        </p>

        <pre class="programlisting brush: php">
// Use the Mcrypt adapter
$filter1 = new Zend_Filter_Encrypt(array(&#039;adapter&#039; =&gt; &#039;mcrypt&#039;));

// Use the OpenSSL adapter
$filter2 = new Zend_Filter_Encrypt(array(&#039;adapter&#039; =&gt; &#039;openssl&#039;));
</pre>


        <p class="para">
            To set another adapter you can also use  <span class="methodname">setAdapter()</span>, and the
             <span class="methodname">getAdapter()</span> method to receive the actual set adapter.
        </p>

        <pre class="programlisting brush: php">
// Use the Mcrypt adapter
$filter = new Zend_Filter_Encrypt();
$filter-&gt;setAdapter(&#039;openssl&#039;);
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                When you do not supply the <span class="property">adapter</span> option or do not use
                 <span class="methodname">setAdapter()</span>, then the <span class="classname">Mcrypt</span>
                adapter will be used per default.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.filter.set.encrypt.mcrypt"><div class="info"><h1 class="title">Encryption with Mcrypt</h1></div>
        

        <p class="para">
            When you have installed the <span class="classname">Mcrypt</span> extension you can use the
            <span class="classname">Mcrypt</span> adapter. If you provide a string instead of an array of
            options, this string will be used as key.
        </p>

        <p class="para">
            You can get and set the encryption values also afterwards with the
             <span class="methodname">getEncryption()</span> and  <span class="methodname">setEncryption()</span>
            methods.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                Note that you will get an exception if the mcrypt extension is not available in your
                environment.
            </p>
        </p></blockquote>

        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                You should also note that all settings which be checked when you create the instance
                or when you call  <span class="methodname">setEncryption()</span>. If mcrypt detects problem
                with your settings an exception will be thrown.
            </p>
        </p></blockquote>

        <p class="para">
            You can get or set the encryption vector by calling  <span class="methodname">getVector()</span>
            and  <span class="methodname">setVector()</span>. A given string will be truncated or padded to
            the needed vector size of the used algorithm.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                Note that when you are not using an own vector, you must get the vector and store
                it. Otherwise you will not be able to decode the encoded string.
            </p>
        </p></blockquote>

        <pre class="programlisting brush: php">
// Use the default blowfish settings
$filter = new Zend_Filter_Encrypt(&#039;myencryptionkey&#039;);

// Set a own vector, otherwise you must call getVector()
// and store this vector for later decryption
$filter-&gt;setVector(&#039;myvector&#039;);
// $filter-&gt;getVector();

$encrypted = $filter-&gt;filter(&#039;text_to_be_encoded&#039;);
print $encrypted;

// For decryption look at the Decrypt filter
</pre>

    </div>

    <div class="section" id="zend.filter.set.encrypt.mcryptdecrypt"><div class="info"><h1 class="title">Decryption with Mcrypt</h1></div>
        

        <p class="para">
            For decrypting content which was previously encrypted with <span class="classname">Mcrypt</span>
            you need to have the options with which the encryption has been called.
        </p>

        <p class="para">
            There is one eminent difference for you. When you did not provide a vector at
            encryption you need to get it after you encrypted the content by using the
             <span class="methodname">getVector()</span> method on the encryption filter. Without the
            correct vector you will not be able to decrypt the content.
        </p>

        <p class="para">
            As soon as you have provided all options decryption is as simple as encryption.
        </p>

        <pre class="programlisting brush: php">
// Use the default blowfish settings
$filter = new Zend_Filter_Decrypt(&#039;myencryptionkey&#039;);

// Set the vector with which the content was encrypted
$filter-&gt;setVector(&#039;myvector&#039;);

$decrypted = $filter-&gt;filter(&#039;encoded_text_normally_unreadable&#039;);
print $decrypted;
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                Note that you will get an exception if the mcrypt extension is not available in your
                environment.
            </p>
        </p></blockquote>

        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                You should also note that all settings which be checked when you create the instance
                or when you call  <span class="methodname">setEncryption()</span>. If mcrypt detects problem
                with your settings an exception will be thrown.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.filter.set.encrypt.openssl"><div class="info"><h1 class="title">Encryption with OpenSSL</h1></div>
        

        <p class="para">
            When you have installed the <span class="classname">OpenSSL</span> extension you can use the
            <span class="classname">OpenSSL</span> adapter. You can get or set the public keys also
            afterwards with the  <span class="methodname">getPublicKey()</span> and
             <span class="methodname">setPublicKey()</span> methods. The private key can also be get and set
            with the related  <span class="methodname">getPrivateKey()</span> and
             <span class="methodname">setPrivateKey()</span> methods.
        </p>

        <pre class="programlisting brush: php">
// Use openssl and provide a private key
$filter = new Zend_Filter_Encrypt(array(
    &#039;adapter&#039; =&gt; &#039;openssl&#039;,
    &#039;private&#039; =&gt; &#039;/path/to/mykey/private.pem&#039;
));

// of course you can also give the public keys at initiation
$filter-&gt;setPublicKey(array(
    &#039;/public/key/path/first.pem&#039;,
    &#039;/public/key/path/second.pem&#039;
));
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                Note that the <span class="classname">OpenSSL</span> adapter will not work when you do not
                provide valid keys.
            </p>
        </p></blockquote>

        <p class="para">
            When you want to encode also the keys, then you have to provide a passphrase with the
             <span class="methodname">setPassphrase()</span> method. When you want to decode content which
            was encoded with a passphrase you will not only need the public key, but also the
            passphrase to decode the encrypted key.
        </p>

        <pre class="programlisting brush: php">
// Use openssl and provide a private key
$filter = new Zend_Filter_Encrypt(array(
    &#039;adapter&#039; =&gt; &#039;openssl&#039;,
    &#039;private&#039; =&gt; &#039;/path/to/mykey/private.pem&#039;
));

// of course you can also give the public keys at initiation
$filter-&gt;setPublicKey(array(
    &#039;/public/key/path/first.pem&#039;,
    &#039;/public/key/path/second.pem&#039;
));
$filter-&gt;setPassphrase(&#039;mypassphrase&#039;);
</pre>


        <p class="para">
            At last, when you use OpenSSL you need to give the receiver the encrypted content, the
            passphrase when have provided one, and the envelope keys for decryption.
        </p>

        <p class="para">
            This means for you, that you have to get the envelope keys after the encryption with the
             <span class="methodname">getEnvelopeKey()</span> method.
        </p>

        <p class="para">
            So our complete example for encrypting content with <span class="classname">OpenSSL</span> look
            like this.
        </p>

        <pre class="programlisting brush: php">
// Use openssl and provide a private key
$filter = new Zend_Filter_Encrypt(array(
    &#039;adapter&#039; =&gt; &#039;openssl&#039;,
    &#039;private&#039; =&gt; &#039;/path/to/mykey/private.pem&#039;
));

// of course you can also give the public keys at initiation
$filter-&gt;setPublicKey(array(
    &#039;/public/key/path/first.pem&#039;,
    &#039;/public/key/path/second.pem&#039;
));
$filter-&gt;setPassphrase(&#039;mypassphrase&#039;);

$encrypted = $filter-&gt;filter(&#039;text_to_be_encoded&#039;);
$envelope  = $filter-&gt;getEnvelopeKey();
print $encrypted;

// For decryption look at the Decrypt filter
</pre>


        <div class="section" id="zend.filter.set.encrypt.openssl.simplified"><div class="info"><h1 class="title">Simplified usage with Openssl</h1></div>
            

            <p class="para">
                As seen before, you need to get the envelope key to be able to decrypt the previous
                encrypted value. This can be very annoying when you work with multiple values.
            </p>

            <p class="para">
                To have a simplified usage you can set the <span class="property">package</span> option to
                <b><tt>TRUE</tt></b>. The default value is <b><tt>FALSE</tt></b>.
            </p>

            <pre class="programlisting brush: php">
// Use openssl and provide a private key
$filter = new Zend_Filter_Encrypt(array(
    &#039;adapter&#039; =&gt; &#039;openssl&#039;,
    &#039;private&#039; =&gt; &#039;/path/to/mykey/private.pem&#039;,
    &#039;public&#039;  =&gt; &#039;/public/key/path/public.pem&#039;,
    &#039;package&#039; =&gt; true
));

$encrypted = $filter-&gt;filter(&#039;text_to_be_encoded&#039;);
print $encrypted;

// For decryption look at the Decrypt filter
</pre>


            <p class="para">
                Now the returned value contains the encrypted value and the envelope. You don&#039;t
                need to get them after the compression. But, and this is the negative aspect of
                this feature, the encrypted value can now only be decrypted by using
                <span class="classname">Zend_Filter_Encrypt</span>.
            </p>
        </div>

        <div class="section" id="zend.filter.set.encrypt.openssl.compressed"><div class="info"><h1 class="title">Compressing the content</h1></div>
            

            <p class="para">
                Based on the original value, the encrypted value can be a very large string. To
                reduce the value <span class="classname">Zend_Filter_Encrypt</span> allows the usage of
                compression.
            </p>

            <p class="para">
                The <span class="property">compression</span> option can eighter be set to the name of a
                compression adapter, or to an array which sets all wished options for the
                compression adapter.
            </p>

            <pre class="programlisting brush: php">
// Use basic compression adapter
$filter1 = new Zend_Filter_Encrypt(array(
    &#039;adapter&#039;     =&gt; &#039;openssl&#039;,
    &#039;private&#039;     =&gt; &#039;/path/to/mykey/private.pem&#039;,
    &#039;public&#039;      =&gt; &#039;/public/key/path/public.pem&#039;,
    &#039;package&#039;     =&gt; true,
    &#039;compression&#039; =&gt; &#039;bz2&#039;
));

// Use basic compression adapter
$filter2 = new Zend_Filter_Encrypt(array(
    &#039;adapter&#039;     =&gt; &#039;openssl&#039;,
    &#039;private&#039;     =&gt; &#039;/path/to/mykey/private.pem&#039;,
    &#039;public&#039;      =&gt; &#039;/public/key/path/public.pem&#039;,
    &#039;package&#039;     =&gt; true,
    &#039;compression&#039; =&gt; array(&#039;adapter&#039; =&gt; &#039;zip&#039;, &#039;target&#039; =&gt; &#039;\usr\tmp\tmp.zip&#039;)
));
</pre>


            <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Decryption with same settings</b><br /></span>
                

                <p class="para">
                    When you want to decrypt a value which is additionally compressed, then you
                    need to set the same compression settings for decryption as for encryption.
                    Otherwise the decryption will fail.
                </p>
            </p></blockquote>
        </div>
    </div>

    <div class="section" id="zend.filter.set.encrypt.openssldecrypt"><div class="info"><h1 class="title">Decryption with OpenSSL</h1></div>
        

        <p class="para">
            Decryption with <span class="classname">OpenSSL</span> is as simple as encryption. But you need
            to have all data from the person who encrypted the content. See the following example:
        </p>

        <pre class="programlisting brush: php">
// Use openssl and provide a private key
$filter = new Zend_Filter_Decrypt(array(
    &#039;adapter&#039; =&gt; &#039;openssl&#039;,
    &#039;private&#039; =&gt; &#039;/path/to/mykey/private.pem&#039;
));

// of course you can also give the envelope keys at initiation
$filter-&gt;setEnvelopeKey(array(
    &#039;/key/from/encoder/first.pem&#039;,
    &#039;/key/from/encoder/second.pem&#039;
));
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                Note that the <span class="classname">OpenSSL</span> adapter will not work when you do not
                provide valid keys.
            </p>
        </p></blockquote>

        <p class="para">
            Optionally it could be necessary to provide the passphrase for decrypting the keys
            themself by using the  <span class="methodname">setPassphrase()</span> method.
        </p>

        <pre class="programlisting brush: php">
// Use openssl and provide a private key
$filter = new Zend_Filter_Decrypt(array(
    &#039;adapter&#039; =&gt; &#039;openssl&#039;,
    &#039;private&#039; =&gt; &#039;/path/to/mykey/private.pem&#039;
));

// of course you can also give the envelope keys at initiation
$filter-&gt;setEnvelopeKey(array(
    &#039;/key/from/encoder/first.pem&#039;,
    &#039;/key/from/encoder/second.pem&#039;
));
$filter-&gt;setPassphrase(&#039;mypassphrase&#039;);
</pre>


        <p class="para">
            At last, decode the content. Our complete example for decrypting the previously
            encrypted content looks like this.
        </p>

        <pre class="programlisting brush: php">
// Use openssl and provide a private key
$filter = new Zend_Filter_Decrypt(array(
    &#039;adapter&#039; =&gt; &#039;openssl&#039;,
    &#039;private&#039; =&gt; &#039;/path/to/mykey/private.pem&#039;
));

// of course you can also give the envelope keys at initiation
$filter-&gt;setEnvelopeKey(array(
    &#039;/key/from/encoder/first.pem&#039;,
    &#039;/key/from/encoder/second.pem&#039;
));
$filter-&gt;setPassphrase(&#039;mypassphrase&#039;);

$decrypted = $filter-&gt;filter(&#039;encoded_text_normally_unreadable&#039;);
print $decrypted;
</pre>

    </div>
</div>
    <div class="section" id="zend.filter.set.htmlentities"><div class="info"><h1 class="title">HtmlEntities</h1></div>
    

    <p class="para">
        Returns the string <var class="varname">$value</var>, converting characters to their corresponding
        <acronym class="acronym">HTML</acronym> entity equivalents where they exist.
    </p>

    <div class="section" id="zend.filter.set.htmlentities.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_HtmlEntities</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_HtmlEntities</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">quotestyle</span></em>: Equivalent to the
                    <acronym class="acronym">PHP</acronym> htmlentities native function parameter
                    <em class="emphasis">quote_style</em>. This allows you to define what will be done
                    with &#039;single&#039; and &quot;double&quot; quotes. The following constants are accepted:

                    <b><tt>ENT_COMPAT</tt></b>, <b><tt>ENT_QUOTES</tt></b>
                    <b><tt>ENT_NOQUOTES</tt></b> with the default being
                    <b><tt>ENT_COMPAT</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">charset</span></em>: Equivalent to the
                    <acronym class="acronym">PHP</acronym> htmlentities native function parameter
                    <em class="emphasis">charset</em>. This defines the character set to be used in
                    filtering. Unlike the <acronym class="acronym">PHP</acronym> native function the default is
                    &#039;UTF-8&#039;. See &quot;http://php.net/htmlentities&quot; for a list of supported character
                    sets.
                </p>

                <blockquote class="note"><p><b class="note">Note</b>: 
                    <p class="para">
                     This option can also be set via the <var class="varname">$options</var> parameter as a
                     <span class="classname">Zend_Config</span> object or array. The option key will be
                     accepted as either charset or encoding.
                    </p>
                </p></blockquote>
            </li>

             <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">doublequote</span></em>: Equivalent to the
                    <acronym class="acronym">PHP</acronym> htmlentities native function parameter
                    <em class="emphasis">double_encode</em>. If set to false existing html entities will
                    not be encoded. The default is to convert everything (true).
                </p>

                <blockquote class="note"><p><b class="note">Note</b>: 
                    <p class="para">
                        This option must be set via the <var class="varname">$options</var> parameter or the
                         <span class="methodname">setDoubleEncode()</span> method.
                    </p>
                </p></blockquote>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.htmlentities.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            See the following example for the default behaviour of this filter.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_HtmlEntities();

print $filter-&gt;filter(&#039;&lt;&#039;);
</pre>

    </div>

    <div class="section" id="zend.filter.set.htmlentities.quotestyle"><div class="info"><h1 class="title">Quote Style</h1></div>
        

        <p class="para">
            <span class="classname">Zend_Filter_HtmlEntities</span> allows changing the quote style used.
            This can be useful when you want to leave double, single, or both types of quotes
            un-filtered. See the following example:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_HtmlEntities(array(&#039;quotestyle&#039; =&gt; ENT_QUOTES));

$input  = &quot;A &#039;single&#039; and &quot; . &#039;&quot;double&quot;&#039;;
print $filter-&gt;filter($input);
</pre>


        <p class="para">
            The above example returns
            <em class="emphasis">A &#039;single&#039; and &quot;double&quot;</em>. Notice that &#039;single&#039;
            as well as &quot;double&quot; quotes are filtered.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_HtmlEntities(array(&#039;quotestyle&#039; =&gt; ENT_COMPAT));

$input  = &quot;A &#039;single&#039; and &quot; . &#039;&quot;double&quot;&#039;;
print $filter-&gt;filter($input);
</pre>


        <p class="para">
            The above example returns <em class="emphasis">A &#039;single&#039; and &quot;double&quot;</em>.
            Notice that &quot;double&quot; quotes are filtered while &#039;single&#039; quotes are not altered.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_HtmlEntities(array(&#039;quotestyle&#039; =&gt; ENT_NOQUOTES));

$input  = &quot;A &#039;single&#039; and &quot; . &#039;&quot;double&quot;&#039;;
print $filter-&gt;filter($input);
</pre>


        <p class="para">
            The above example returns <em class="emphasis">A &#039;single&#039; and &quot;double&quot;</em>. Notice that
            neither &quot;double&quot; or &#039;single&#039; quotes are altered.
        </p>
    </div>

    <div class="section" id="zend.filter.set.htmlentities."><div class="info"><h1 class="title">Helper Methods</h1></div>
        

        <p class="para">
            To change or retrieve the <span class="property">quotestyle</span> after instantiation, the two
            methods  <span class="methodname">setQuoteStyle()</span> and
             <span class="methodname">getQuoteStyle()</span> may be used respectively.
             <span class="methodname">setQuoteStyle()</span> accepts one parameter
            <var class="varname">$quoteStyle</var>. The following constants are accepted:
            <b><tt>ENT_COMPAT</tt></b>, <b><tt>ENT_QUOTES</tt></b>,
            <b><tt>ENT_NOQUOTES</tt></b>
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_HtmlEntities();

$filter-&gt;setQuoteStyle(ENT_QUOTES);
print $filter-&gt;getQuoteStyle(ENT_QUOTES);
</pre>


        <p class="para">
            To change or retrieve the <span class="property">charset</span> after instantiation, the two
            methods  <span class="methodname">setCharSet()</span> and  <span class="methodname">getCharSet()</span>
            may be used respectively.  <span class="methodname">setCharSet()</span> accepts one parameter
            <var class="varname">$charSet</var>. See &quot;http://php.net/htmlentities&quot; for a list of supported
            character sets.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_HtmlEntities();

$filter-&gt;setQuoteStyle(ENT_QUOTES);
print $filter-&gt;getQuoteStyle(ENT_QUOTES);
</pre>


        <p class="para">
            To change or retrieve the <span class="property">doublequote</span> option after instantiation,
            the two methods  <span class="methodname">setDoubleQuote()</span> and
             <span class="methodname">getDoubleQuote()</span> may be used respectively.
             <span class="methodname">setDoubleQuote()</span> accepts one boolean parameter
            <var class="varname">$doubleQuote</var>.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_HtmlEntities();

$filter-&gt;setQuoteStyle(ENT_QUOTES);
print $filter-&gt;getQuoteStyle(ENT_QUOTES);
</pre>

    </div>
</div>
    <div class="section" id="zend.filter.set.int"><div class="info"><h1 class="title">Int</h1></div>
    

    <p class="para">
        <span class="classname">Zend_Filter_Int</span> allows you to transform a sclar value which contains
        into an integer.
    </p>

    <div class="section" id="zend.filter.set.int.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Int</h1></div>
        

        <p class="para">
            There are no additional options for <span class="classname">Zend_Filter_Int</span>.
        </p>
    </div>

    <div class="section" id="zend.filter.set.int.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            A basic example of usage is below:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Int();

print $filter-&gt;filter(&#039;-4 is less than 0&#039;);
</pre>


        <p class="para">
            This will return &#039;-4&#039;.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.localizedtonormalized"><div class="info"><h1 class="title">LocalizedToNormalized and NormalizedToLocalized</h1></div>
    

    <p class="para">
        These two filters can change given localized input to it&#039;s normalized representation and
        reverse. They use in Background <span class="classname">Zend_Locale</span> to do this transformation
        for you.
    </p>

    <div class="section" id="zend.filter.set.localizedtonormalized.options"><div class="info"><h1 class="title">
            Supported options for Zend_Filter_LocalizedToNormalized and
            Zend_Filter_NormalizedToLocalized
        </h1></div>
        

        <p class="para">
            The following options are supported for
            <span class="classname">Zend_Filter_LocalizedToNormalized</span> and
            <span class="classname">Zend_Filter_NormalizedToLocalized</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">date_format</span></em>: This sets the date format
                    to use for normalization and to detect the localized date format
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">locale</span></em>: This sets the locale to use
                    for normalization and to detect the localized format
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">precision</span></em>: This sets the precision to
                    use for number conversion
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.localizedtonormalized.workflow"><div class="info"><h1 class="title">Workflow</h1></div>
        

        <p class="para">
            Normalization allows your user to enter informations in his own language notation, and
            you can then store the normalized value into your database for example. Localization
            on the other hand allows you to display normalized informations in a localized manner
            to your user.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                Please note that normalization and localization is not equal to translation. These
                filters can not translate strings from one language into another like you could
                expect with months or names of days.
            </p>
        </p></blockquote>

        <p class="para">
            The following input types can be normalized and localized:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">integer</em>: Integer numbers. Normalization returns the english
                    notation
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">float</em>: Float numbers. Normalization returns the english
                    notation
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">numbers</em>: Other numbers, like real. Normalization returns
                    the english notation
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">time</em>: Time values. The normalized value is a named array
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">date</em>: Date values. The normalized value is a named array
                </p>
            </li>
        </ul>

        <p class="para">
            Any other input will be returned as is, without changing it.
        </p>

        <blockquote class="note"><p><b class="note">Note</b>: 
            <p class="para">
                You should note that normalized output is always given as string. Otherwise your
                environment would transfer the normalized output automatically to the notation used
                by the locale your environment is set to.
            </p>
        </p></blockquote>
    </div>

    <div class="section" id="zend.filter.set.localizedtonormalized.numbersnormal"><div class="info"><h1 class="title">Normalization for numbers</h1></div>
        

        <p class="para">
            Any given number like integer, float or real value, can be normalized. Note, that
            numbers in scientific notation, can actually not be handled by this filter.
        </p>

        <p class="para">
            So how does this normalization work in detail for numbers:
        </p>

        <pre class="programlisting brush: php">
// Initiate the filter
$filter = new Zend_Filter_LocalizedToNormalized();
$filter-&gt;filter(&#039;123.456,78&#039;);
// returns the value &#039;123456.78&#039;
</pre>


        <p class="para">
            Let&#039;s expect you have set the locale &#039;de&#039; as application wide locale.
            <span class="classname">Zend_Filter_LocalizedToNormalized</span> will take the set locale and
            use it to detect which sort of input you gave. In our example it was a value with
            precision. Now the filter will return you the normalized representation for this value
            as string.
        </p>

        <p class="para">
            You can also control how your normalized number has to look like. Therefor you can give
            all options which are also used by <span class="classname">Zend_Locale_Format</span>. For
            details about available options take a look into this
            <a href="zend.locale.parsing.html" class="link">Zend_Locale chapter</a>.
        </p>

        <p class="para">
            Below is a example with defined precision so you can see how options work:
        </p>

        <pre class="programlisting brush: php">
// Numeric Filter
$filter = new Zend_Filter_LocalizedToNormalized(array(&#039;precision&#039; =&gt; 2));

$filter-&gt;filter(&#039;123.456&#039;);
// returns the value &#039;123456.00&#039;

$filter-&gt;filter(&#039;123.456,78901&#039;);
// returns the value &#039;123456.79&#039;
</pre>

    </div>

    <div class="section" id="zend.filter.set.localizedtonormalized.dates"><div class="info"><h1 class="title">Normalization for date and time</h1></div>
        

        <p class="para">
            Input for date and time values can also be normalized. All given date and time values
            will be returned as array, where each date part is given within a own key.
        </p>

        <pre class="programlisting brush: php">
// Initiate the filter
$filter = new Zend_Filter_LocalizedToNormalized();
$filter-&gt;filter(&#039;12.April.2009&#039;);
// returns array(&#039;day&#039; =&gt; &#039;12&#039;, &#039;month&#039; =&gt; &#039;04&#039;, &#039;year&#039; =&gt; &#039;2009&#039;)
</pre>


        <p class="para">
            Let&#039;s expect you have set the locale &#039;de&#039; again. Now the input is automatically detected
            as date, and you will get a named array in return.
        </p>

        <p class="para">
            Of course you can also control how your date input looks like with the
            <em class="emphasis">date_format</em> and the <em class="emphasis">locale</em> option.
        </p>

        <pre class="programlisting brush: php">
// Date Filter
$filter = new Zend_Filter_LocalizedToNormalized(
    array(&#039;date_format&#039; =&gt; &#039;ss:mm:HH&#039;)
);

$filter-&gt;filter(&#039;11:22:33&#039;);
// returns array(&#039;hour&#039; =&gt; &#039;33&#039;, &#039;minute&#039; =&gt; &#039;22&#039;, &#039;second&#039; =&gt; &#039;11&#039;)
</pre>

    </div>

    <div class="section" id="zend.filter.set.localizedtonormalized.numberslocal"><div class="info"><h1 class="title">Localization for numbers</h1></div>
        

        <p class="para">
            Any given number like integer, float or real value, can be localized. Note, that
            numbers in scientific notation, can actually not be handled by this filter.
        </p>

        <p class="para">
            So how does localization work in detail for numbers:
        </p>

        <pre class="programlisting brush: php">
// Initiate the filter
$filter = new Zend_Filter_NormalizedToLocalized();
$filter-&gt;filter(123456.78);
// returns the value &#039;123.456,78&#039;
</pre>


        <p class="para">
            Let&#039;s expect you have set the locale &#039;de&#039; as application wide locale.
            <span class="classname">Zend_Filter_NormalizedToLocalized</span> will take the set locale and
            use it to detect which sort of output you want to have. In our example it was a value
            with precision. Now the filter will return you the localized representation for this
            value as string.
        </p>

        <p class="para">
            You can also control how your localized number has to look like. Therefor you can give
            all options which are also used by <span class="classname">Zend_Locale_Format</span>. For
            details about how these options are used take a look into this
            <a href="zend.locale.parsing.html" class="link">Zend_Locale chapter</a>.
        </p>

        <p class="para">
            Below is a example with defined precision so you can see how options
            work:
        </p>

        <pre class="programlisting brush: php">
// Numeric Filter
$filter = new Zend_Filter_NormalizedToLocalized(array(&#039;precision&#039; =&gt; 2));

$filter-&gt;filter(123456);
// returns the value &#039;123.456,00&#039;

$filter-&gt;filter(123456.78901);
// returns the value &#039;123.456,79&#039;
</pre>

    </div>

    <div class="section" id="zend.filter.set.normalizedtolocalized.dates"><div class="info"><h1 class="title">Localization for date and time</h1></div>
        

        <p class="para">
            Normalized for date and time values can also be localized. All given date and time
            values will be returned as string, with the format defined by the set locale.
        </p>

        <pre class="programlisting brush: php">
// Initiate the filter
$filter = new Zend_Filter_NormalizedToLocalized();
$filter-&gt;filter(array(&#039;day&#039; =&gt; &#039;12&#039;, &#039;month&#039; =&gt; &#039;04&#039;, &#039;year&#039; =&gt; &#039;2009&#039;);
// returns &#039;12.04.2009&#039;
</pre>


        <p class="para">
            Let&#039;s expect you have set the locale &#039;de&#039; again. Now the input is automatically detected
            as date, and will be returned in the format defined by the locale &#039;de&#039;.
        </p>

        <p class="para">
            Of course you can also control how your date input looks like with the
            <em class="emphasis">date_format</em>, and the <em class="emphasis">locale</em> option.
        </p>

        <pre class="programlisting brush: php">
// Date Filter
$filter = new Zend_Filter_LocalizedToNormalized(
    array(&#039;date_format&#039; =&gt; &#039;ss:mm:HH&#039;)
);

$filter-&gt;filter(array(&#039;hour&#039; =&gt; &#039;33&#039;, &#039;minute&#039; =&gt; &#039;22&#039;, &#039;second&#039; =&gt; &#039;11&#039;));
// returns &#039;11:22:33&#039;
</pre>

    </div>
</div>
    <div class="section" id="zend.filter.set.null"><div class="info"><h1 class="title">Null</h1></div>
    

    <p class="para">
        This filter will change the given input to be <b><tt>NULL</tt></b> if it meets specific
        criteria. This is often necessary when you work with databases and want to have a
        <b><tt>NULL</tt></b> value instead of a boolean or any other type.
    </p>

    <div class="section" id="zend.filter.set.null.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_Null</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_Null</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">type</span></em>: The variable type which should
                    be supported.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.null.default"><div class="info"><h1 class="title">Default behaviour for Zend_Filter_Null</h1></div>
        

        <p class="para">
            Per default this filter works like <acronym class="acronym">PHP</acronym>&#039;s
             <span class="methodname">empty()</span> method; in other words, if
             <span class="methodname">empty()</span> returns a boolean <b><tt>TRUE</tt></b>, then a
            <b><tt>NULL</tt></b> value will be returned.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_Null();
$value  = &#039;&#039;;
$result = $filter-&gt;filter($value);
// returns null instead of the empty string
</pre>


        <p class="para">
            This means that without providing any configuration,
            <span class="classname">Zend_Filter_Null</span> will accept all input types and return
            <b><tt>NULL</tt></b> in the same cases as  <span class="methodname">empty()</span>.
        </p>

        <p class="para">
            Any other value will be returned as is, without any changes.
        </p>
    </div>

    <div class="section" id="zend.filter.set.null.types"><div class="info"><h1 class="title">Changing behaviour for Zend_Filter_Null</h1></div>
        

        <p class="para">
            Sometimes it&#039;s not enough to filter based on  <span class="methodname">empty()</span>. Therefor
            <span class="classname">Zend_Filter_Null</span> allows you to configure which type will be
            converted and which not.
        </p>

        <p class="para">
            The following types can be handled:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis">boolean</em>: Converts a boolean
                    <em class="emphasis"><b><tt>FALSE</tt></b></em> value to
                    <b><tt>NULL</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">integer</em>: Converts an integer <em class="emphasis">0</em> value
                    to <b><tt>NULL</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">empty_array</em>: Converts an empty <em class="emphasis">array</em>
                    to <b><tt>NULL</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">string</em>: Converts an empty string <em class="emphasis">&#039;&#039;</em> to
                    <b><tt>NULL</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">zero</em>: Converts a string containing the single character
                    zero (<em class="emphasis">&#039;0&#039;</em>) to <b><tt>NULL</tt></b>.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis">all</em>: Converts all above types to <b><tt>NULL</tt></b>.
                    (This is the default behavior.)
                </p>
            </li>
        </ul>

        <p class="para">
            There are several ways to select which of the above types are filtered. You can give one
            or multiple types and add them, you can give an array, you can use constants, or you can
            give a textual string. See the following examples:
        </p>

        <pre class="programlisting brush: php">
// converts false to null
$filter = new Zend_Filter_Null(Zend_Filter_Null::BOOLEAN);

// converts false and 0 to null
$filter = new Zend_Filter_Null(
    Zend_Filter_Null::BOOLEAN + Zend_Filter_Null::INTEGER
);

// converts false and 0 to null
$filter = new Zend_Filter_Null( array(
    Zend_Filter_Null::BOOLEAN,
    Zend_Filter_Null::INTEGER
));

// converts false and 0 to null
$filter = new Zend_Filter_Null(array(
    &#039;boolean&#039;,
    &#039;integer&#039;,
));
</pre>


        <p class="para">
            You can also give an instance of <span class="classname">Zend_Config</span> to set the wished
            types. To set types afterwards use  <span class="methodname">setType()</span>.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.pregreplace"><div class="info"><h1 class="title">PregReplace</h1></div>
    

    <p class="para">
        <span class="classname">Zend_Filter_PregReplace</span> performs a search using regular expressions
        and replaces all found elements.
    </p>

    <div class="section" id="zend.filter.set.pregreplace.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_PregReplace</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_PregReplace</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">match</span></em>: The pattern which will be
                    searched for.
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">replace</span></em>: The string which is used as
                    replacement for the matches.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.pregreplace.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            To use this filter properly you must give two options:
        </p>

        <p class="para">
            The option <span class="property">match</span> has to be given to set the pattern which will be
            searched for. It can be a string for a single pattern, or an array of strings for
            multiple pattern.
        </p>

        <p class="para">
            To set the pattern which will be used as replacement the option
            <span class="property">replace</span> has to be used. It can be a string for a single pattern, or
            an array of strings for multiple pattern.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_PregReplace(array(&#039;match&#039; =&gt; &#039;/bob/&#039;,
                                            &#039;replace&#039; =&gt; &#039;john&#039;));
$input  = &#039;Hy bob!&#039;;

$filter-&gt;filter($input);
// returns &#039;Hy john!&#039;
</pre>


        <p class="para">
            You can use  <span class="methodname">getMatchPattern()</span> and
             <span class="methodname">setMatchPattern()</span> to set the matching pattern afterwards. To
            set the replacement pattern you can use  <span class="methodname">getReplacement()</span> and
             <span class="methodname">setReplacement()</span>.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_PregReplace();
$filter-&gt;setMatchPattern(array(&#039;bob&#039;, &#039;Hy&#039;))
       -&gt;setReplacement(array(&#039;john&#039;, &#039;Bye&#039;));
$input  = &#039;Hy bob!&quot;;

$filter-&gt;filter($input);
// returns &#039;Bye john!&#039;
</pre>


        <p class="para">
            For a more complex usage take a look into <acronym class="acronym">PHP</acronym>&#039;s <a href="http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php" class="link external">&raquo; PCRE
                Pattern Chapter</a>.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.realpath"><div class="info"><h1 class="title">RealPath</h1></div>
    

    <p class="para">
        This filter will resolve given links and pathnames and returns canonicalized absolute
        pathnames.
    </p>

    <div class="section" id="zend.filter.set.realpath.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_RealPath</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_RealPath</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">exists</span></em>: This option defaults to
                    <b><tt>TRUE</tt></b> which checks if the given path really exists.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.realpath.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            For any given link of pathname its absolute path will be returned.
            References to &#039;<var class="filename">/./</var>&#039;, &#039;<var class="filename">/../</var>&#039; and extra
            &#039;<var class="filename">/</var>&#039; characters in the input path will be stripped. The resulting
            path will not have any symbolic link, &#039;<var class="filename">/./</var>&#039; or
            &#039;<var class="filename">/../</var>&#039; character.
        </p>

        <p class="para">
            <span class="classname">Zend_Filter_RealPath</span> will return <b><tt>FALSE</tt></b> on
            failure, e.g. if the file does not exist. On <acronym class="acronym">BSD</acronym> systems
            <span class="classname">Zend_Filter_RealPath</span> doesn&#039;t fail if only the last path component
            doesn&#039;t exist, while other systems will return <b><tt>FALSE</tt></b>.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_RealPath();
$path   = &#039;/www/var/path/../../mypath&#039;;
$filtered = $filter-&gt;filter($path);

// returns &#039;/www/mypath&#039;
</pre>

    </div>

    <div class="section" id="zend.filter.set.realpath.exists"><div class="info"><h1 class="title">Non existing paths</h1></div>
        

        <p class="para">
            Sometimes it is useful to get also paths when they don&#039;t exist, f.e. when you want to
            get the real path for a path which you want to create. You can then either give a
            <b><tt>FALSE</tt></b> at initiation, or use  <span class="methodname">setExists()</span> to
            set it.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_RealPath(false);
$path   = &#039;/www/var/path/../../non/existing/path&#039;;
$filtered = $filter-&gt;filter($path);

// returns &#039;/www/non/existing/path&#039;
// even when file_exists or realpath would return false
</pre>

    </div>
</div>
    <div class="section" id="zend.filter.set.stringtolower"><div class="info"><h1 class="title">StringToLower</h1></div>
    

    <p class="para">
        This filter converts any input to be lowercased.
    </p>

    <div class="section" id="zend.filter.set.stringtolower.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_StringToLower</h1></div>
        

        <p class="para">
            The following options are supported for
            <span class="classname">Zend_Filter_StringToLower</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">encoding</span></em>: This option can be used to
                    set an encoding which has to be used.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.stringtolower.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            This is a basic example:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StringToLower();

print $filter-&gt;filter(&#039;SAMPLE&#039;);
// returns &quot;sample&quot;
</pre>

    </div>

    <div class="section" id="zend.filter.set.stringtolower.encoding"><div class="info"><h1 class="title">Different encoded strings</h1></div>
        

        <p class="para">
            Per default it will only handle characters from the actual locale of your
            server. Characters from other charsets would be ignored. Still, it&#039;s
            possible to also lowercase them when the mbstring extension is available
            in your environment. Simply set the wished encoding when initiating the
            <span class="classname">StringToLower</span> filter. Or use the
             <span class="methodname">setEncoding()</span> method to change the encoding afterwards.
        </p>

        <pre class="programlisting brush: php">
// using UTF-8
$filter = new Zend_Filter_StringToLower(&#039;UTF-8&#039;);

// or give an array which can be useful when using a configuration
$filter = new Zend_Filter_StringToLower(array(&#039;encoding&#039; =&gt; &#039;UTF-8&#039;));

// or do this afterwards
$filter-&gt;setEncoding(&#039;ISO-8859-1&#039;);
</pre>


        <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Setting wrong encodings</b><br /></span>
            

            <p class="para">
                Be aware that you will get an exception when you want to set an encoding
                and the mbstring extension is not available in your environment.
            </p>

            <p class="para">
                Also when you are trying to set an encoding which is not supported by your
                mbstring extension you will get an exception.
            </p>
        </p></blockquote>
    </div>
</div>
    <div class="section" id="zend.filter.set.stringtoupper"><div class="info"><h1 class="title">StringToUpper</h1></div>
    

    <p class="para">
        This filter converts any input to be uppercased.
    </p>

    <div class="section" id="zend.filter.set.stringtoupper.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_StringToUpper</h1></div>
        

        <p class="para">
            The following options are supported for
            <span class="classname">Zend_Filter_StringToUpper</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">encoding</span></em>: This option can be used to
                    set an encoding which has to be used.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.stringtoupper.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            This is a basic example for using the <span class="classname">StringToUpper</span> filter:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StringToUpper();

print $filter-&gt;filter(&#039;Sample&#039;);
// returns &quot;SAMPLE&quot;
</pre>


    </div>

    <div class="section" id="zend.filter.set.stringtoupper.encoding"><div class="info"><h1 class="title">Different encoded strings</h1></div>
        

        <p class="para">
            Like the <span class="classname">StringToLower</span> filter, this filter handles
            only characters from the actual locale of your server. Using different
            character sets works the same as with <span class="classname">StringToLower</span>.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StringToUpper(array(&#039;encoding&#039; =&gt; &#039;UTF-8&#039;));

// or do this afterwards
$filter-&gt;setEncoding(&#039;ISO-8859-1&#039;);
</pre>

    </div>
</div>
    <div class="section" id="zend.filter.set.stringtrim"><div class="info"><h1 class="title">StringTrim</h1></div>
    

    <p class="para">
        This filter modifies a given string such that certain characters are removed from the
        beginning and end.
    </p>

     <div class="section" id="zend.filter.set.stringtrim.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_StringTrim</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_StringTrim</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">charlist</span></em>: List of characters to
                    remove from the beginning and end of the string. If this is not set or is null,
                    the default behavior will be invoked, which is to remove only whitespace from
                    the beginning and end of the string.
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.stringtrim.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            A basic example of usage is below:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StringTrim();

print $filter-&gt;filter(&#039; This is (my) content: &#039;);
</pre>


        <p class="para">
            The above example returns &#039;This is (my) content:&#039;. Notice that the whitespace characters
            have been removed.
        </p>
    </div>

    <div class="section" id="zend.filter.set.stringtrim.types"><div class="info"><h1 class="title">Default behaviour for Zend_Filter_StringTrim</h1></div>
        

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StringTrim(&#039;:&#039;);
// or new Zend_Filter_StringTrim(array(&#039;charlist&#039; =&gt; &#039;:&#039;));

print $filter-&gt;filter(&#039; This is (my) content:&#039;);
</pre>


        <p class="para">
            The above example returns &#039;This is (my) content&#039;. Notice that the whitespace characters
            and colon are removed. You can also provide an instance of
            <span class="classname">Zend_Config</span> or an array with a &#039;charlist&#039; key. To set the
            desired character list after instantiation, use the
             <span class="methodname">setCharList()</span> method.
            The  <span class="methodname">getCharList()</span> return the values set for charlist.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.stripnewlines"><div class="info"><h1 class="title">StripNewLines</h1></div>
    

    <p class="para">
        This filter modifies a given string and removes all new line characters within that string.
    </p>

     <div class="section" id="zend.filter.set.strinpnewlines.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_StripNewLines</h1></div>
        

        <p class="para">
            There are no additional options for <span class="classname">Zend_Filter_StripNewLines</span>.
        </p>
    </div>

    <div class="section" id="zend.filter.set.stripnewlines.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            A basic example of usage is below:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StripNewLines();

print $filter-&gt;filter(&quot;This is (my)\n\rcontent: &#039;);
</pre>


        <p class="para">
            The above example returns &#039;This is (my) content:&#039;. Notice that all newline characters
            have been removed.
        </p>
    </div>
</div>
    <div class="section" id="zend.filter.set.striptags"><div class="info"><h1 class="title">StripTags</h1></div>
    

    <p class="para">
        This filter can strip <acronym class="acronym">XML</acronym> and <acronym class="acronym">HTML</acronym> tags from given
        content.
    </p>

    <div class="warning"><b class="warning">Warning</b><div class="info"><h1 class="title">Zend_Filter_StripTags is potentially unsecure</h1></div>
        

        <p class="para">
            Be warned that <span class="classname">Zend_Filter_StripTags</span> should only be used to strip
            all available tags.
        </p>

        <p class="para">
            Using <span class="classname">Zend_Filter_StripTags</span> to make your site
            <em class="emphasis">secure</em> by stripping some unwanted tags will lead to unsecure and
            dangerous code.
        </p>

        <p class="para">
            <span class="classname">Zend_Filter_StripTags</span> must not be used to prevent
            <acronym class="acronym">XSS</acronym> attacks. This filter is no replacement for using Tidy or
            HtmlPurifier.
        </p>
    </div>

    <div class="section" id="zend.filter.set.striptags.options"><div class="info"><h1 class="title">Supported options for Zend_Filter_StripTags</h1></div>
        

        <p class="para">
            The following options are supported for <span class="classname">Zend_Filter_StripTags</span>:
        </p>

        <ul class="itemizedlist">
            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">allowAttribs</span></em>: This option sets the
                    attributes which are accepted. All other attributes are stripped from the given
                    content
                </p>
            </li>

            <li class="listitem">
                <p class="para">
                    <em class="emphasis"><span class="property">allowTags</span></em>: This option sets the tags
                    which are accepted. All other tags will be stripped from the given content
                </p>
            </li>
        </ul>
    </div>

    <div class="section" id="zend.filter.set.striptags.basic"><div class="info"><h1 class="title">Basic usage</h1></div>
        

        <p class="para">
            See the following example for the default behaviour of this filter:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StripTags();

print $filter-&gt;filter(&#039;&lt;B&gt;My content&lt;/B&gt;&#039;);
</pre>


        <p class="para">
            As result you will get the stripped content &#039;My content&#039;.
        </p>

        <p class="para">
            When the content contains broken or partitial tags then the complete following content
            will be erased. See the following example:
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StripTags();

print $filter-&gt;filter(&#039;This contains &lt;a href=&quot;http://example.com&quot;&gt;no ending tag&#039;);
</pre>


        <p class="para">
            The above will return &#039;This contains&#039; with the rest being stripped.
        </p>
    </div>

    <div class="section" id="zend.filter.set.striptags.allowtags"><div class="info"><h1 class="title">Allowing defined tags</h1></div>
        

        <p class="para">
            <span class="classname">Zend_Filter_StripTags</span> allows stripping of all but defined tags.
            This can be used for example to strip all tags but links from a text.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StripTags(array(&#039;allowTags&#039; =&gt; &#039;a&#039;));

$input  = &quot;A text with &lt;br/&gt; a &lt;a href=&#039;link.com&#039;&gt;link&lt;/a&gt;&quot;;
print $filter-&gt;filter($input);
// returns: A text with a &lt;a href=&#039;link.com&#039;&gt;link&lt;/a&gt;
</pre>


        <p class="para">
            The above example strips all tags but the link. By providing an array you can set
            multiple tags at once.
        </p>

        <div class="warning"><b class="warning">Warning</b>
            <p class="para">
                Do not use this feature to get a <em class="emphasis">probably secure</em> content. This
                component does not replace the use of a proper configured html filter.
            </p>
        </div>
    </div>

    <div class="section" id="zend.filter.set.striptags.allowattribs"><div class="info"><h1 class="title">Allowing defined attributes</h1></div>
        

        <p class="para">
            It is also possible to strip all but allowed attributes from a tag.
        </p>

        <pre class="programlisting brush: php">
$filter = new Zend_Filter_StripTags(array(&#039;allowAttribs&#039; =&gt; &#039;src&#039;));

$input  = &quot;A text with &lt;br/&gt; a &lt;img src=&#039;picture.com&#039; width=&#039;100&#039;&gt;picture&lt;/img&gt;&quot;;
print $filter-&gt;filter($input);
// returns: A text with a &lt;img src=&#039;picture.com&#039;&gt;picture&lt;/img&gt;
</pre>


        <p class="para">
            The above example strips all tags but img. Additionally from the img tag all
            attributes but src will be stripped. By providing an array you can set multiple
            attributes at once.
        </p>
    </div>
</div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.filter.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.filter.html">Zend_Filter</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.filter.filter_chains.html">Filter Chains</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.filter.html">Zend_Filter</a></li>
  <li><a href="zend.filter.introduction.html">Introduction</a></li>
  <li class="active"><a href="zend.filter.set.html">Standard Filter Classes</a></li>
  <li><a href="zend.filter.filter_chains.html">Filter Chains</a></li>
  <li><a href="zend.filter.writing_filters.html">Writing Filters</a></li>
  <li><a href="zend.filter.input.html">Zend_Filter_Input</a></li>
  <li><a href="zend.filter.inflector.html">Zend_Filter_Inflector</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>